// 响应json
var http = require('http');
http.createServer(function (request, response) {
  // 'Content-Type': 'application/json': 用开传递json字符串
  response.writeHead(200, {'Content-Type': 'application/json'});
  const obj = {
    name: 'cs',
    age: 18,
  }
  response.end(JSON.stringify(obj));
}).listen(8081);

console.log('Server running at http://127.0.0.1:8081/');